package com.pig.openg1.graphics;

import android.content.Context;
import android.opengl.GLSurfaceView;
import android.util.AttributeSet;
import android.view.MotionEvent;

import com.pig.openg1.render.GraphFiveRender;

public class DrawView5 extends GLSurfaceView {

    private GraphFiveRender mRender;

    public DrawView5(Context context) {
        super(context);

    }

    public DrawView5(Context context, AttributeSet attrs) {
        super(context, attrs);

    }

    public void setRenderer(GraphFiveRender renderer) {
        mRender = renderer;
        super.setRenderer(renderer);
    }

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        if(event.getAction() == MotionEvent.ACTION_DOWN)
        {
            if(mRender != null)
            {
                queueEvent(new Runnable() {
                    @Override
                    public void run() {
                        mRender.switchMode();
                    }
                });
            }
        }
        return super.onTouchEvent(event);
    }
}
